package com.apac.controllers;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jmesa.limit.ExportType;
import org.jmesa.model.TableModel;
import org.jmesa.view.component.Column;
import org.jmesa.view.component.Row;
import org.jmesa.view.component.Table;
import org.jmesa.view.html.component.HtmlColumn;
import org.jmesa.view.html.component.HtmlRow;
import org.jmesa.view.html.component.HtmlTable;
import org.jmesa.view.html.event.RowEvent;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.apac.bom.TestObject;
import com.apac.dao.TestDao;

@Controller
@RequestMapping("/client_reports")
public class ClientReportsController {

	@RequestMapping(value="", method=RequestMethod.GET)
	public ModelAndView clientReports(HttpServletRequest request, HttpServletResponse response) {

		ModelAndView mv = new ModelAndView("ClientReports");
		
		String globeContractualHeadcount = generateGlobeContractualHeadcount(request, response);
		String globeOutsourcedHeadcount = generateGlobeContractualHeadcount(request, response);
		String globeEOC = generateGlobeContractualHeadcount(request, response);
		
		String uhgMasterlist = generateUHGMasterlist(request, response);
		String uhgEndofContract = generateUHGEndofContract(request, response);
		
		mv.addObject("globeContractualHeadcount",globeContractualHeadcount);
		mv.addObject("globeOutsourcedHeadcount",globeOutsourcedHeadcount);
		mv.addObject("globeEOC",globeEOC);
		mv.addObject("uhgMasterlist",uhgMasterlist);
		mv.addObject("uhgEndofContract",uhgEndofContract);
		return mv;
	}
	
	public String generateGlobeContractualHeadcount(HttpServletRequest request, HttpServletResponse response){
		/**MOCK DATA**/
		ArrayList<TestObject> data = new ArrayList<TestObject>();
		TestDao tDao = new TestDao();
		data = tDao.retrieveAll();
		/**MOCK DATA**/
		
		TableModel tableModel = new TableModel("globeContractualHeadcount", request, response);
		
		tableModel.setExportTypes(ExportType.CSV,ExportType.JEXCEL,ExportType.PDFP);
		tableModel.setItems(data);
		
		if(tableModel.isExporting()){
			Table Table = new Table().caption("Globe Contractual Headcount Record");
			
			Row Row = new Row();
			Table.setRow(Row);
			
			Column col1 = new Column("id").title("PSRF No.");
			Row.addColumn(col1);
	
			Column col2 = new Column("att1").title("Contractual Surname");
			Row.addColumn(col2);
	
			Column col3 = new Column("att2").title("Contractual First Name");
			Row.addColumn(col3);
	
			Column col4 = new Column("att3").title("Concatenate (FULLNAME)");
			Row.addColumn(col4); 
			
			Column col27 = new Column("att2").title("Agency Code");
			Row.addColumn(col27);
	
			Column col28 = new Column("att3").title("Engagement Type");
			Row.addColumn(col28); 
	
			Column col5 = new Column("att1").title("Start Date");
			Row.addColumn(col5);
	
			Column col6 = new Column("att2").title("End Date");
			Row.addColumn(col6);
	
			Column col7 = new Column("att3").title("Contract Extension");
			Row.addColumn(col7); 
	
			Column col8 = new Column("att1").title("Job Title (Position)");
			Row.addColumn(col8);
	
			Column col9 = new Column("att2").title("Cost Center");
			Row.addColumn(col9);
	
			Column col10 = new Column("att1").title("Group");
			Row.addColumn(col10);
	
			Column col11 = new Column("att2").title("Division");
			Row.addColumn(col11);
	
			Column col12 = new Column("att2").title("Department");
			Row.addColumn(col12);
	
			Column col13 = new Column("att2").title("IS - Last Name");
			Row.addColumn(col13);
	
			Column col14 = new Column("att2").title("IS - First Name");
			Row.addColumn(col14);
	
			Column col15 = new Column("att2").title("Work Location");
			Row.addColumn(col15);
	
			Column col16 = new Column("att2").title("Project Name");
			Row.addColumn(col16);
	
			Column col17 = new Column("att2").title("Project Description");
			Row.addColumn(col17);
	
			Column col18 = new Column("att2").title("Remarks from Agency");
			Row.addColumn(col18);
	
			Column col19 = new Column("att2").title("Monthly Rate");
			Row.addColumn(col19);
	
			Column col20 = new Column("att2").title("Statutory Benefits");
			Row.addColumn(col20);
	
			Column col21 = new Column("att2").title("OT");
			Row.addColumn(col21);
	
			Column col22 = new Column("att2").title("Admin Fee");
			Row.addColumn(col22);
	
			Column col23 = new Column("att2").title("Total");
			Row.addColumn(col23);
	
			Column col24 = new Column("att2").title("Talent Segment");
			Row.addColumn(col24);
	
			Column col25 = new Column("att2").title("Billing Details");
			Row.addColumn(col25);
	
			Column col26 = new Column("att2").title("Remarks");
			Row.addColumn(col26);
	
			tableModel.setTable(Table);
			
			String export = tableModel.render();
			return export;
		}
		else{
			HtmlTable htmlTable = new HtmlTable();
	
			HtmlRow HtmlRow = new HtmlRow();
			HtmlRow.setOnclick(new RowEvent() {
	            public String execute(Object item, int rowcount) {
	                return "alert('Object" +item.toString()+ " Rowcount"+ rowcount +"')";
	            }
	        });
			htmlTable.setRow(HtmlRow);
									
			HtmlColumn col1 = new HtmlColumn("id").title("PSRF No.");
			HtmlRow.addColumn(col1);
	
			HtmlColumn col2 = new HtmlColumn("att1").title("Contractual Surname");
			HtmlRow.addColumn(col2);
	
			HtmlColumn col3 = new HtmlColumn("att2").title("Contractual First Name");
			HtmlRow.addColumn(col3);
	
			HtmlColumn col4 = new HtmlColumn("att3").title("Concatenate (FULLNAME)");
			HtmlRow.addColumn(col4); 
			
			HtmlColumn col27 = new HtmlColumn("att2").title("Agency Code");
			HtmlRow.addColumn(col27);
	
			HtmlColumn col28 = new HtmlColumn("att3").title("Engagement Type");
			HtmlRow.addColumn(col28); 
	
			HtmlColumn col5 = new HtmlColumn("att1").title("Start Date");
			HtmlRow.addColumn(col5);
	
			HtmlColumn col6 = new HtmlColumn("att2").title("End Date");
			HtmlRow.addColumn(col6);
	
			HtmlColumn col7 = new HtmlColumn("att3").title("Contract Extension");
			HtmlRow.addColumn(col7); 
	
			HtmlColumn col8 = new HtmlColumn("att1").title("Job Title (Position)");
			HtmlRow.addColumn(col8);
	
			HtmlColumn col9 = new HtmlColumn("att2").title("Cost Center");
			HtmlRow.addColumn(col9);
	
			HtmlColumn col10 = new HtmlColumn("att1").title("Group");
			HtmlRow.addColumn(col10);
	
			HtmlColumn col11 = new HtmlColumn("att2").title("Division");
			HtmlRow.addColumn(col11);
	
			HtmlColumn col12 = new HtmlColumn("att2").title("Department");
			HtmlRow.addColumn(col12);
	
			HtmlColumn col13 = new HtmlColumn("att2").title("IS - Last Name");
			HtmlRow.addColumn(col13);
	
			HtmlColumn col14 = new HtmlColumn("att2").title("IS - First Name");
			HtmlRow.addColumn(col14);
	
			HtmlColumn col15 = new HtmlColumn("att2").title("Work Location");
			HtmlRow.addColumn(col15);
	
			HtmlColumn col16 = new HtmlColumn("att2").title("Project Name");
			HtmlRow.addColumn(col16);
	
			HtmlColumn col17 = new HtmlColumn("att2").title("Project Description");
			HtmlRow.addColumn(col17);
	
			HtmlColumn col18 = new HtmlColumn("att2").title("Remarks from Agency");
			HtmlRow.addColumn(col18);
	
			HtmlColumn col19 = new HtmlColumn("att2").title("Monthly Rate");
			HtmlRow.addColumn(col19);
	
			HtmlColumn col20 = new HtmlColumn("att2").title("Statutory Benefits");
			HtmlRow.addColumn(col20);
	
			HtmlColumn col21 = new HtmlColumn("att2").title("OT");
			HtmlRow.addColumn(col21);
	
			HtmlColumn col22 = new HtmlColumn("att2").title("Admin Fee");
			HtmlRow.addColumn(col22);
	
			HtmlColumn col23 = new HtmlColumn("att2").title("Total");
			HtmlRow.addColumn(col23);
	
			HtmlColumn col24 = new HtmlColumn("att2").title("Talent Segment");
			HtmlRow.addColumn(col24);
	
			HtmlColumn col25 = new HtmlColumn("att2").title("Billing Details");
			HtmlRow.addColumn(col25);
	
			HtmlColumn col26 = new HtmlColumn("att2").title("Remarks");
			HtmlRow.addColumn(col26);
	    	
//	    	HtmlColumn viewLink = new HtmlColumn("id").title("View");
//	    	viewLink.setCellEditor(new CellEditor() {             
//				public Object getValue(Object item, String property, int rowcount) {                 
//	    			//Object value = new HtmlCellEditor().getValue(item, property, rowcount);                 
//	    			HtmlBuilder html = new HtmlBuilder();
//	    			ExamResponse er = (ExamResponse)item;
//	    			html.a().href().quote().append("JMesaExportStudentExamServlet?id="+er.getExamResponseID()).quote().close();
//	    			html.append("View Response");
//	    			html.aEnd();
//	    			return html.toString();             
//	    			}         
//	    		});
//	    	viewLink.setSortable(false);
//	    	viewLink.setFilterable(false);
//	    	htmlRow.addColumn(viewLink); 
	
			tableModel.setTable(htmlTable);
	
			String html = tableModel.render();
			return html;
		}
	}
	public String generateGlobeOutsourcedHeadcount(HttpServletRequest request, HttpServletResponse response){
		/**MOCK DATA**/
		ArrayList<TestObject> data = new ArrayList<TestObject>();
		TestDao tDao = new TestDao();
		data = tDao.retrieveAll();
		/**MOCK DATA**/
		
		TableModel tableModel = new TableModel("globeOutsourcedHeadcount", request, response);
		
		
		tableModel.setExportTypes(ExportType.CSV,ExportType.JEXCEL,ExportType.PDFP);
		tableModel.setItems(data);
		
		if(tableModel.isExporting()){
			Table Table = new Table().caption("Globe Outsourced Headcount Record");
			
			Row Row = new Row();
			Table.setRow(Row);
			
			Column col1 = new Column("id").title("PSRF No.");
			
			Row.addColumn(col1);
	
			Column col2 = new Column("att1").title("Contractual Surname");
			Row.addColumn(col2);
	
			Column col3 = new Column("att2").title("Contractual First Name");
			Row.addColumn(col3);
			
			Column col27 = new Column("att2").title("Agency Code");
			Row.addColumn(col27);
	
			Column col28 = new Column("att3").title("Engagement Type");
			Row.addColumn(col28); 
	
			Column col4 = new Column("att3").title("Start Date");
			Row.addColumn(col4); 
	
			Column col5 = new Column("att1").title("End Date");
			Row.addColumn(col5);
	
			Column col6 = new Column("att2").title("IS - Last Name");
			Row.addColumn(col6);
	
			Column col7 = new Column("att3").title("IS - First Name");
			Row.addColumn(col7); 
	
			Column col8 = new Column("att1").title("Total");
			Row.addColumn(col8);
	
			Column col9 = new Column("att2").title("Talent Segment");
			Row.addColumn(col9);
	
			Column col10 = new Column("att1").title("Billing Details");
			Row.addColumn(col10);
	
			Column col11 = new Column("att2").title("Remarks");
			Row.addColumn(col11);
	
			tableModel.setTable(Table);
			
			String export = tableModel.render();
			return export;
		}
		else{
			HtmlTable htmlTable = new HtmlTable();
	
			HtmlRow HtmlRow = new HtmlRow();
			HtmlRow.setOnclick(new RowEvent() {
	            public String execute(Object item, int rowcount) {
	                return "alert('Object" +item.toString()+ " Rowcount"+ rowcount +"')";
	            }
	        });
			htmlTable.setRow(HtmlRow);
						
			HtmlColumn col1 = new HtmlColumn("id").title("PSRF No.");
			HtmlRow.addColumn(col1);
	
			HtmlColumn col2 = new HtmlColumn("att1").title("Contractual Surname");
			HtmlRow.addColumn(col2);
	
			HtmlColumn col3 = new HtmlColumn("att2").title("Contractual First Name");
			HtmlRow.addColumn(col3);
	
			HtmlColumn col4 = new HtmlColumn("att3").title("Start Date");
			HtmlRow.addColumn(col4); 
	
			HtmlColumn col5 = new HtmlColumn("att1").title("End Date");
			HtmlRow.addColumn(col5);
	
			HtmlColumn col6 = new HtmlColumn("att2").title("IS - Last Name");
			HtmlRow.addColumn(col6);
	
			HtmlColumn col7 = new HtmlColumn("att3").title("IS - First Name");
			HtmlRow.addColumn(col7); 
	
			HtmlColumn col8 = new HtmlColumn("att1").title("Total");
			HtmlRow.addColumn(col8);
	
			HtmlColumn col9 = new HtmlColumn("att2").title("Talent Segment");
			HtmlRow.addColumn(col9);
	
			HtmlColumn col10 = new HtmlColumn("att1").title("Billing Details");
			HtmlRow.addColumn(col10);
	
			HtmlColumn col11 = new HtmlColumn("att2").title("Remarks");
			HtmlRow.addColumn(col11);
	    	
//	    	HtmlColumn viewLink = new HtmlColumn("id").title("View");
//	    	viewLink.setCellEditor(new CellEditor() {             
//				public Object getValue(Object item, String property, int rowcount) {                 
//	    			//Object value = new HtmlCellEditor().getValue(item, property, rowcount);                 
//	    			HtmlBuilder html = new HtmlBuilder();
//	    			ExamResponse er = (ExamResponse)item;
//	    			html.a().href().quote().append("JMesaExportStudentExamServlet?id="+er.getExamResponseID()).quote().close();
//	    			html.append("View Response");
//	    			html.aEnd();
//	    			return html.toString();             
//	    			}         
//	    		});
//	    	viewLink.setSortable(false);
//	    	viewLink.setFilterable(false);
//	    	htmlRow.addColumn(viewLink); 
	
			tableModel.setTable(htmlTable);
	
			String html = tableModel.render();
			return html;
		}
	}
	public String generateGlobeEOC(HttpServletRequest request, HttpServletResponse response){
		/**MOCK DATA**/
		ArrayList<TestObject> data = new ArrayList<TestObject>();
		TestDao tDao = new TestDao();
		data = tDao.retrieveAll();
		/**MOCK DATA**/
		
		TableModel tableModel = new TableModel("globeEOC", request, response);
		
		tableModel.setExportTypes(ExportType.CSV,ExportType.JEXCEL,ExportType.PDFP);
		tableModel.setItems(data);
		
		if(tableModel.isExporting()){
			Table Table = new Table().caption("Globe EOC Record");
			
			Row Row = new Row();
			Table.setRow(Row);
			
			Column col1 = new Column("id").title("PSRF No.");
			Row.addColumn(col1);
	
			Column col2 = new Column("att1").title("Contractual Surname");
			Row.addColumn(col2);
	
			Column col3 = new Column("att2").title("Contractual First Name");
			Row.addColumn(col3);
	
			Column col4 = new Column("att3").title("Concatenate (FULLNAME)");
			Row.addColumn(col4); 
				
			Column col5 = new Column("att1").title("Agency Code");
			Row.addColumn(col5);
	
			Column col6 = new Column("att2").title("Engagement Type");
			Row.addColumn(col6);
	
			Column col7 = new Column("att3").title("Start Date");
			Row.addColumn(col7); 
	
			Column col8 = new Column("att1").title("End Date");
			Row.addColumn(col8);
	
			Column col9 = new Column("att2").title("Contract Extension");
			Row.addColumn(col9);
	
			Column col10 = new Column("att1").title("Job Title (Position)");
			Row.addColumn(col10);
	
			Column col11 = new Column("att2").title("Cost Center");
			Row.addColumn(col11);
	
			Column col12 = new Column("att2").title("Group");
			Row.addColumn(col12);
	
			Column col13 = new Column("att2").title("Division");
			Row.addColumn(col13);
	
			Column col14 = new Column("att2").title("Department");
			Row.addColumn(col14);
	
			Column col15 = new Column("att2").title("IS - Last Name");
			Row.addColumn(col15);
	
			Column col16 = new Column("att2").title("IS - First Name");
			Row.addColumn(col16);
	
			Column col17 = new Column("att2").title("Work Location");
			Row.addColumn(col17);
	
			Column col18 = new Column("att2").title("Project Name");
			Row.addColumn(col18);
	
			Column col19 = new Column("att2").title("Project Description");
			Row.addColumn(col19);
	
			Column col20 = new Column("att2").title("Remarks from Agency");
			Row.addColumn(col20);
	
			Column col21 = new Column("att2").title("Monthly Rate");
			Row.addColumn(col21);
	
			Column col22 = new Column("att2").title("Statutory Benefits");
			Row.addColumn(col22);
	
			Column col23 = new Column("att2").title("OT");
			Row.addColumn(col23);
	
			Column col24 = new Column("att2").title("Admin Fee");
			Row.addColumn(col24);
	
			Column col25 = new Column("att2").title("Total");
			Row.addColumn(col25);
	
			Column col26 = new Column("att2").title("Talent Segment");
			Row.addColumn(col26);
	
			Column col27 = new Column("att2").title("Billing Details");
			Row.addColumn(col27);
	
			Column col28 = new Column("att2").title("Remarks");
			Row.addColumn(col28);
	
			tableModel.setTable(Table);
			
			String export = tableModel.render();
			return export;
		}
		else{
			HtmlTable htmlTable = new HtmlTable();
	
			HtmlRow HtmlRow = new HtmlRow();
			HtmlRow.setOnclick(new RowEvent() {
	            public String execute(Object item, int rowcount) {
	                return "alert('Object" +item.toString()+ " Rowcount"+ rowcount +"')";
	            }
	        });
			htmlTable.setRow(HtmlRow);
						
			HtmlColumn col1 = new HtmlColumn("id").title("PSRF No.");
			HtmlRow.addColumn(col1);
	
			HtmlColumn col2 = new HtmlColumn("att1").title("Contractual Surname");
			HtmlRow.addColumn(col2);
	
			HtmlColumn col3 = new HtmlColumn("att2").title("Contractual First Name");
			HtmlRow.addColumn(col3);
	
			HtmlColumn col4 = new HtmlColumn("att3").title("Concatenate (FULLNAME)");
			HtmlRow.addColumn(col4); 
			
			HtmlColumn col5 = new HtmlColumn("att1").title("Agency Code");
			HtmlRow.addColumn(col5);
	
			HtmlColumn col6 = new HtmlColumn("att2").title("Engagement Type");
			HtmlRow.addColumn(col6);
	
			HtmlColumn col7 = new HtmlColumn("att3").title("Start Date");
			HtmlRow.addColumn(col7); 
	
			HtmlColumn col8 = new HtmlColumn("att1").title("End Date");
			HtmlRow.addColumn(col8);
	
			HtmlColumn col9 = new HtmlColumn("att2").title("Contract Extension");
			HtmlRow.addColumn(col9);
	
			HtmlColumn col10 = new HtmlColumn("att1").title("Job Title (Position)");
			HtmlRow.addColumn(col10);
	
			HtmlColumn col11 = new HtmlColumn("att2").title("Cost Center");
			HtmlRow.addColumn(col11);
	
			HtmlColumn col12 = new HtmlColumn("att2").title("Group");
			HtmlRow.addColumn(col12);
	
			HtmlColumn col13 = new HtmlColumn("att2").title("Division");
			HtmlRow.addColumn(col13);
	
			HtmlColumn col14 = new HtmlColumn("att2").title("Department");
			HtmlRow.addColumn(col14);
	
			HtmlColumn col15 = new HtmlColumn("att2").title("IS - Last Name");
			HtmlRow.addColumn(col15);
	
			HtmlColumn col16 = new HtmlColumn("att2").title("IS - First Name");
			HtmlRow.addColumn(col16);
	
			HtmlColumn col17 = new HtmlColumn("att2").title("Work Location");
			HtmlRow.addColumn(col17);
	
			HtmlColumn col18 = new HtmlColumn("att2").title("Project Name");
			HtmlRow.addColumn(col18);
	
			HtmlColumn col19 = new HtmlColumn("att2").title("Project Description");
			HtmlRow.addColumn(col19);
	
			HtmlColumn col20 = new HtmlColumn("att2").title("Remarks from Agency");
			HtmlRow.addColumn(col20);
	
			HtmlColumn col21 = new HtmlColumn("att2").title("Monthly Rate");
			HtmlRow.addColumn(col21);
	
			HtmlColumn col22 = new HtmlColumn("att2").title("Statutory Benefits");
			HtmlRow.addColumn(col22);
	
			HtmlColumn col23 = new HtmlColumn("att2").title("OT");
			HtmlRow.addColumn(col23);
	
			HtmlColumn col24 = new HtmlColumn("att2").title("Admin Fee");
			HtmlRow.addColumn(col24);
	
			HtmlColumn col25 = new HtmlColumn("att2").title("Total");
			HtmlRow.addColumn(col25);
	
			HtmlColumn col26 = new HtmlColumn("att2").title("Talent Segment");
			HtmlRow.addColumn(col26);
	
			HtmlColumn col27 = new HtmlColumn("att2").title("Billing Details");
			HtmlRow.addColumn(col27);
	
			HtmlColumn col28 = new HtmlColumn("att2").title("Remarks");
			HtmlRow.addColumn(col28);
	    	
//	    	HtmlColumn viewLink = new HtmlColumn("id").title("View");
//	    	viewLink.setCellEditor(new CellEditor() {             
//				public Object getValue(Object item, String property, int rowcount) {                 
//	    			//Object value = new HtmlCellEditor().getValue(item, property, rowcount);                 
//	    			HtmlBuilder html = new HtmlBuilder();
//	    			ExamResponse er = (ExamResponse)item;
//	    			html.a().href().quote().append("JMesaExportStudentExamServlet?id="+er.getExamResponseID()).quote().close();
//	    			html.append("View Response");
//	    			html.aEnd();
//	    			return html.toString();             
//	    			}         
//	    		});
//	    	viewLink.setSortable(false);
//	    	viewLink.setFilterable(false);
//	    	htmlRow.addColumn(viewLink); 
	
			tableModel.setTable(htmlTable);
	
			String html = tableModel.render();
			return html;
		}
	}
	public String generateUHGMasterlist(HttpServletRequest request, HttpServletResponse response){
		/**MOCK DATA**/
		ArrayList<TestObject> data = new ArrayList<TestObject>();
		TestDao tDao = new TestDao();
		data = tDao.retrieveAll();
		/**MOCK DATA**/
		
		TableModel tableModel = new TableModel("uhgMasterlist", request, response);
		
		tableModel.setExportTypes(ExportType.CSV,ExportType.JEXCEL,ExportType.PDFP);
		tableModel.setItems(data);
		
		if(tableModel.isExporting()){
			Table Table = new Table().caption("UHG Masterlist Record");
			
			Row Row = new Row();
			Table.setRow(Row);
			
			Column col1 = new Column("id").title("LASTNAME");
			Row.addColumn(col1);
	
			Column col2 = new Column("att1").title("FIRSTNAME");
			Row.addColumn(col2);
	
			Column col3 = new Column("att2").title("POSITION");
			Row.addColumn(col3);
	
			Column col4 = new Column("att3").title("MANAGER");
			Row.addColumn(col4); 
	
			Column col5 = new Column("att1").title("ORIGINAL STARTDATE");
			Row.addColumn(col5);
	
			Column col6 = new Column("att2").title("ORIGINAL END DATE");
			Row.addColumn(col6);
	
			Column col7 = new Column("att3").title("CONTRACT");
			Row.addColumn(col7); 
	
			Column col8 = new Column("att1").title("BILL RATE/HR");
			Row.addColumn(col8);
	
			Column col9 = new Column("att2").title("RATE/HR");
			Row.addColumn(col9);
	
			Column col10 = new Column("att1").title("SID");
			Row.addColumn(col10);
	
			Column col11 = new Column("att2").title("CODE");
			Row.addColumn(col11);
	
			Column col12 = new Column("att2").title("EMAIL ADDRESS");
			Row.addColumn(col12);
	
			Column col13 = new Column("att2").title("CONTACT DETAILS");
			Row.addColumn(col13);
	
			Column col14 = new Column("att2").title("BIRTHDATE");
			Row.addColumn(col14);
	
			Column col15 = new Column("att2").title("YRS. OF EXPERIENCE");
			Row.addColumn(col15);
	
			Column col16 = new Column("att2").title("DEGREE/LICENSE");
			Row.addColumn(col16);
	
			Column col17 = new Column("att2").title("SKILLS");
			Row.addColumn(col17);
	
			Column col18 = new Column("att2").title("Initial Contract Start Date");
			Row.addColumn(col18);
	
			Column col19 = new Column("att2").title("Initial Contract End Date");
			Row.addColumn(col19);
	
			Column col20 = new Column("att2").title("Work Order Start Date");
			Row.addColumn(col20);
	
			Column col21 = new Column("att2").title("Work Order End Date");
			Row.addColumn(col21);
	
			Column col22 = new Column("att2").title("2013 Contract Renewal Start Date");
			Row.addColumn(col22);
	
			Column col23 = new Column("att2").title("2013 Contract Renewal End Date");
			Row.addColumn(col23);
	
			Column col24 = new Column("att2").title("Comments");
			Row.addColumn(col24);
	
			tableModel.setTable(Table);
			
			String export = tableModel.render();
			return export;
		}
		else{
			HtmlTable htmlTable = new HtmlTable();
	
			HtmlRow HtmlRow = new HtmlRow();
			HtmlRow.setOnclick(new RowEvent() {
	            public String execute(Object item, int rowcount) {
	                return "alert('Object" +item.toString()+ " Rowcount"+ rowcount +"')";
	            }
	        });
			htmlTable.setRow(HtmlRow);
						
			HtmlColumn col1 = new HtmlColumn("id").title("LASTNAME");
			HtmlRow.addColumn(col1);
	
			HtmlColumn col2 = new HtmlColumn("att1").title("FIRSTNAME");
			HtmlRow.addColumn(col2);
	
			HtmlColumn col3 = new HtmlColumn("att2").title("POSITION");
			HtmlRow.addColumn(col3);
	
			HtmlColumn col4 = new HtmlColumn("att3").title("MANAGER");
			HtmlRow.addColumn(col4); 
	
			HtmlColumn col5 = new HtmlColumn("att1").title("ORIGINAL STARTDATE");
			HtmlRow.addColumn(col5);
	
			HtmlColumn col6 = new HtmlColumn("att2").title("ORIGINAL END DATE");
			HtmlRow.addColumn(col6);
	
			HtmlColumn col7 = new HtmlColumn("att3").title("CONTRACT");
			HtmlRow.addColumn(col7); 
	
			HtmlColumn col8 = new HtmlColumn("att1").title("BILL RATE/HR");
			HtmlRow.addColumn(col8);
	
			HtmlColumn col9 = new HtmlColumn("att2").title("RATE/HR");
			HtmlRow.addColumn(col9);
	
			HtmlColumn col10 = new HtmlColumn("att1").title("SID");
			HtmlRow.addColumn(col10);
	
			HtmlColumn col11 = new HtmlColumn("att2").title("CODE");
			HtmlRow.addColumn(col11);
	
			HtmlColumn col12 = new HtmlColumn("att2").title("EMAIL ADDRESS");
			HtmlRow.addColumn(col12);
	
			HtmlColumn col13 = new HtmlColumn("att2").title("CONTACT DETAILS");
			HtmlRow.addColumn(col13);
	
			HtmlColumn col14 = new HtmlColumn("att2").title("BIRTHDATE");
			HtmlRow.addColumn(col14);
	
			HtmlColumn col15 = new HtmlColumn("att2").title("YRS. OF EXPERIENCE");
			HtmlRow.addColumn(col15);
	
			HtmlColumn col16 = new HtmlColumn("att2").title("DEGREE/LICENSE");
			HtmlRow.addColumn(col16);
	
			HtmlColumn col17 = new HtmlColumn("att2").title("SKILLS");
			HtmlRow.addColumn(col17);
	
			HtmlColumn col18 = new HtmlColumn("att2").title("Initial Contract Start Date");
			HtmlRow.addColumn(col18);
	
			HtmlColumn col19 = new HtmlColumn("att2").title("Initial Contract End Date");
			HtmlRow.addColumn(col19);
	
			HtmlColumn col20 = new HtmlColumn("att2").title("Work Order Start Date");
			HtmlRow.addColumn(col20);
	
			HtmlColumn col21 = new HtmlColumn("att2").title("Work Order End Date");
			HtmlRow.addColumn(col21);
	
			HtmlColumn col22 = new HtmlColumn("att2").title("2013 Contract Renewal Start Date");
			HtmlRow.addColumn(col22);
	
			HtmlColumn col23 = new HtmlColumn("att2").title("2013 Contract Renewal End Date");
			HtmlRow.addColumn(col23);
	
			HtmlColumn col24 = new HtmlColumn("att2").title("Comments");
			HtmlRow.addColumn(col24);
	    	
//	    	HtmlColumn viewLink = new HtmlColumn("id").title("View");
//	    	viewLink.setCellEditor(new CellEditor() {             
//				public Object getValue(Object item, String property, int rowcount) {                 
//	    			//Object value = new HtmlCellEditor().getValue(item, property, rowcount);                 
//	    			HtmlBuilder html = new HtmlBuilder();
//	    			ExamResponse er = (ExamResponse)item;
//	    			html.a().href().quote().append("JMesaExportStudentExamServlet?id="+er.getExamResponseID()).quote().close();
//	    			html.append("View Response");
//	    			html.aEnd();
//	    			return html.toString();             
//	    			}         
//	    		});
//	    	viewLink.setSortable(false);
//	    	viewLink.setFilterable(false);
//	    	htmlRow.addColumn(viewLink); 
	
			tableModel.setTable(htmlTable);
	
			String html = tableModel.render();
			return html;
		}
	}
	public String generateUHGEndofContract(HttpServletRequest request, HttpServletResponse response){
		/**MOCK DATA**/
		ArrayList<TestObject> data = new ArrayList<TestObject>();
		TestDao tDao = new TestDao();
		data = tDao.retrieveAll();
		/**MOCK DATA**/
		
		TableModel tableModel = new TableModel("uhgEndofContract", request, response);
		
		tableModel.setExportTypes(ExportType.CSV,ExportType.JEXCEL,ExportType.PDFP);
		tableModel.setItems(data);
		
		if(tableModel.isExporting()){
			Table Table = new Table().caption("UHG End of Contract Record");
			
			Row Row = new Row();
			Table.setRow(Row);
			
			Column col1 = new Column("id").title("LASTNAME");
			Row.addColumn(col1);
	
			Column col2 = new Column("att1").title("FIRSTNAME");
			Row.addColumn(col2);
	
			Column col3 = new Column("att2").title("POSITION");
			Row.addColumn(col3);
	
			Column col4 = new Column("att3").title("MANAGER");
			Row.addColumn(col4); 
	
			Column col5 = new Column("att1").title("END DATE EFFECTIVITY");
			Row.addColumn(col5);
	
			Column col6 = new Column("att2").title("ENDED/RESIGNED");
			Row.addColumn(col6);
	
			Column col7 = new Column("att3").title("START DATE");
			Row.addColumn(col7); 
	
			Column col8 = new Column("att1").title("END DATE");
			Row.addColumn(col8);
	
			Column col9 = new Column("att2").title("CONTRACT");
			Row.addColumn(col9);
	
			Column col10 = new Column("att1").title("BILL RATE/HR");
			Row.addColumn(col10);
	
			Column col11 = new Column("att2").title("RATE/HR");
			Row.addColumn(col11);
	
			Column col12 = new Column("att2").title("SID");
			Row.addColumn(col12);
	
			Column col13 = new Column("att2").title("CODE");
			Row.addColumn(col13);
	
			Column col14 = new Column("att2").title("EMAIL ADD");
			Row.addColumn(col14);
	
			Column col15 = new Column("att2").title("CONTACT DETAILS");
			Row.addColumn(col15);
	
			Column col16 = new Column("att2").title("DOB");
			Row.addColumn(col16);
	
			Column col17 = new Column("att2").title("SKILLS");
			Row.addColumn(col17);
	
			Column col18 = new Column("att2").title("DEGREE");
			Row.addColumn(col18);
	
			Column col19 = new Column("att2").title("HOSPITAL EXPERIENCE");
			Row.addColumn(col19);
	
			tableModel.setTable(Table);
			
			String export = tableModel.render();
			return export;
		}
		else{
			HtmlTable htmlTable = new HtmlTable();
	
			HtmlRow HtmlRow = new HtmlRow();
			HtmlRow.setOnclick(new RowEvent() {
	            public String execute(Object item, int rowcount) {
	                return "alert('Object" +item.toString()+ " Rowcount"+ rowcount +"')";
	            }
	        });
			htmlTable.setRow(HtmlRow);
						
			HtmlColumn col1 = new HtmlColumn("id").title("LASTNAME");
			HtmlRow.addColumn(col1);
	
			HtmlColumn col2 = new HtmlColumn("att1").title("FIRSTNAME");
			HtmlRow.addColumn(col2);
	
			HtmlColumn col3 = new HtmlColumn("att2").title("POSITION");
			HtmlRow.addColumn(col3);
	
			HtmlColumn col4 = new HtmlColumn("att3").title("MANAGER");
			HtmlRow.addColumn(col4); 
	
			HtmlColumn col5 = new HtmlColumn("att1").title("END DATE EFFECTIVITY");
			HtmlRow.addColumn(col5);
	
			HtmlColumn col6 = new HtmlColumn("att2").title("ENDED/RESIGNED");
			HtmlRow.addColumn(col6);
	
			HtmlColumn col7 = new HtmlColumn("att3").title("START DATE");
			HtmlRow.addColumn(col7); 
	
			HtmlColumn col8 = new HtmlColumn("att1").title("END DATE");
			HtmlRow.addColumn(col8);
	
			HtmlColumn col9 = new HtmlColumn("att2").title("CONTRACT");
			HtmlRow.addColumn(col9);
	
			HtmlColumn col10 = new HtmlColumn("att1").title("BILL RATE/HR");
			HtmlRow.addColumn(col10);
	
			HtmlColumn col11 = new HtmlColumn("att2").title("RATE/HR");
			HtmlRow.addColumn(col11);
	
			HtmlColumn col12 = new HtmlColumn("att2").title("SID");
			HtmlRow.addColumn(col12);
	
			HtmlColumn col13 = new HtmlColumn("att2").title("CODE");
			HtmlRow.addColumn(col13);
	
			HtmlColumn col14 = new HtmlColumn("att2").title("EMAIL ADD");
			HtmlRow.addColumn(col14);
	
			HtmlColumn col15 = new HtmlColumn("att2").title("CONTACT DETAILS");
			HtmlRow.addColumn(col15);
	
			HtmlColumn col16 = new HtmlColumn("att2").title("DOB");
			HtmlRow.addColumn(col16);
	
			HtmlColumn col17 = new HtmlColumn("att2").title("SKILLS");
			HtmlRow.addColumn(col17);
	
			HtmlColumn col18 = new HtmlColumn("att2").title("DEGREE");
			HtmlRow.addColumn(col18);
	
			HtmlColumn col19 = new HtmlColumn("att2").title("HOSPITAL EXPERIENCE");
			HtmlRow.addColumn(col19);
	    	
//	    	HtmlColumn viewLink = new HtmlColumn("id").title("View");
//	    	viewLink.setCellEditor(new CellEditor() {             
//				public Object getValue(Object item, String property, int rowcount) {                 
//	    			//Object value = new HtmlCellEditor().getValue(item, property, rowcount);                 
//	    			HtmlBuilder html = new HtmlBuilder();
//	    			ExamResponse er = (ExamResponse)item;
//	    			html.a().href().quote().append("JMesaExportStudentExamServlet?id="+er.getExamResponseID()).quote().close();
//	    			html.append("View Response");
//	    			html.aEnd();
//	    			return html.toString();             
//	    			}         
//	    		});
//	    	viewLink.setSortable(false);
//	    	viewLink.setFilterable(false);
//	    	htmlRow.addColumn(viewLink); 
	
			tableModel.setTable(htmlTable);
	
			String html = tableModel.render();
			return html;
		}
	}
	
}
